package com.manage.controller;


import com.manage.common.R;
import com.manage.dto.OrderAndGoodsDto;
import com.manage.pojo.FlowerStatistics;
import com.manage.service.FlowerStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 后端数据统计
 */
@CrossOrigin
@RestController
@RequestMapping("/flower-statistics")
public class FlowerStatisticsController {

    @Autowired
    private FlowerStatisticsService flowerStatisticsService;


    /**
     * 查询商品销售信息等
     */
    @GetMapping("/getStatistics")
    public R getStatistics(@RequestParam("userId") String userId) {
        FlowerStatistics statistics =  flowerStatisticsService.select_data(userId);
        return R.success(statistics);
    }

    // 查询图表
    @GetMapping("/select")
    public R<List<OrderAndGoodsDto>> selectTable(@RequestParam("userId") String userId){
        List<OrderAndGoodsDto> list = flowerStatisticsService.order_goods(userId);
        return R.success(list);
    }
}

